package com.k2data.service;

import k2paltform.common.util.AvroUtil;
import org.apache.avro.Schema;

/**
 * Created by ming on 16-8-30.
 */
public class FieldGroup {

    private Schema schema;
    private String[] idFields;

    public FieldGroup() {}

    public FieldGroup(byte[] schemaBytes) {
        this(new String(schemaBytes));
    }

    public FieldGroup(String schemaStrs) {
        this(new Schema.Parser().parse(schemaStrs));
    }

    public FieldGroup(Schema schema) {
        this.schema = schema;
        this.idFields = AvroUtil.getIdFields(schema);
    }

    public Schema getSchema() {
        return this.schema;
    }
    public String[] getIdFields() {
        return this.idFields;
    }
}
